package com.ltmonitor.service.impl;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ltmonitor.dao.IJT809CommandDao;
import com.ltmonitor.entity.JT809Command;
import com.ltmonitor.entity.TerminalCommand;
import com.ltmonitor.service.IJT809CommandService;
import com.ltmonitor.util.DateUtil;

@Service("jt809CommandService")
public class JT809CommandService extends BaseService<Long, JT809Command> implements IJT809CommandService {

	@Autowired
	private IJT809CommandDao jt809CommandDao;
	
	public List<JT809Command> getLatestCommand()
	{
		String hsql = "from JT809Command where CreateDate > ? and Status = ? and UserId > 0";
		Date startTime = DateUtil.getDate(DateUtil.now(), Calendar.MINUTE, -5);
		List<JT809Command> result = this.jt809CommandDao.query(hsql,
				new Object[] { startTime, JT809Command.STATUS_NEW });

		return result;
	}
	

}
